package com.xiaoh.leetcode.easy;

/**
 * @author xiaoh
 * @ClassName NumJewelsInStones_771
 * @Description TODO
 * @Date 2021/2/18 下午4:44
 * @Version 1.0
 */
public class NumJewelsInStones_771 {

    public static int numJewelsInStones(String jewels, String stones) {
        int result = 0;
        StringBuilder s1 = new StringBuilder(jewels);
        StringBuilder s2 = new StringBuilder(stones);
        for (int i = 0; i < jewels.length(); i++) {
            for (int j = 0; j < stones.length(); j++) {
                if (s1.charAt(i) == s2.charAt(j)) {
                    result += 1;
                }
            }
        }
        return result;
    }

    public static void main(String[] args) {
//        String J = "aA";
//        String S = "aAAbbbb";
        String J = "z";
        String S = "ZZ";
        System.out.println(numJewelsInStones(J, S));
    }
}
